//Binary I/O <REVIEWED>

std::fstream file(open happens here)
file.clear()
file.open(fileName, <flags>)
//<flags>
	std::ios_base::
	 - in		//Read in from a file
	 - out 		//Write out from a file
	 - trunc 	//Forces the creation of a new file, deletes an existing file if it already exists
	 - binary	//Deault is ascii. Need to send this flag to use binary.'
	 - app		//Append - allows you to add onto an existing file, only if it exists.
	 - ate		//Append to end. Allows you to add onto an existing file. Allows us to change what already
				//exists in the file.
	 
file.close()
file.clear() 	//Clears the fail bits. Always clear after close!!! ALWAYS ALWAYS ALWAYS

read(char* data, dataSize)
write(char* data, dataSize)

struct SomeStruct
{
	int x,y,z;
}

//Assuming there is no special padding from member to member.
SomeStruct theStruct;
file.read((char*)&theStruct, sizeof(theStruct));
//When writing out, write out a whole structure of data.

//Do not use useless buffers. new is bad!

//Number of bytes to seek, where from
seekg(0, std::ios_base::beg) - Moves the read pointer
						cur
						end
						
seekp() //- moves the write poitner

//WIll not work
file.seekg(128);
file.seekp(256);
file.read(data,12);
file.write(otherdata,24);

//Where we at?
tellg() //- 	tells us where the reader pointer is.
tellp()	//- 	tells us where the write pointer is.

//One aswome function we havent used yet: For buffering when files:

gcount() //- tells us how many bytes we have succesfully read during the last 'read' call.
			//For streaming. If we dont know the length of the files. Stream it in and keep on adding the size we read.
			
//Check the failbits to see if they are all ok
.good()

			
			